package onlineCodingQuiz

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("PUT")
        url("/api/v3/onlineCodingQuizzes/1")
        headers {
            header("id", 1)
            contentType(applicationJsonUtf8())
        }
        body("""
        {
            "definitionRepo":"definitionRepo",
            "language":"language",
            "title":"title",
            "tags":[],
            "stackId":1,
            "remark":"remark",
            "quizGroupId":1
        }
        """)
        bodyMatchers {
            jsonPath('$.definitionRepo', byRegex("[\\s\\S]+"))
            jsonPath('$.language', byRegex("[\\s\\S]+"))
            jsonPath('$.title', byRegex("[\\s\\S]+"))
            jsonPath('$.tags', byRegex("[\\s\\S]+"))
            jsonPath('$.stackId', byRegex(number()))
            jsonPath('$.remark', byRegex("[\\s\\S]+"))
            jsonPath('$.quizGroupId', byRegex(number()))
        }
    }
    response {
        status(204)
    }
}
